package problems;

import java.util.ArrayList;
import java.util.List;

import lib.MathLib;

import org.junit.Ignore;

@Ignore //because it takes way longer than the non-threaded version
public class Euler010Threaded extends AbstractThreadedEuler {

	protected final List<Number> answers = new ArrayList<Number>();
	
	@Override
	protected long getStartValue() {
		return 2;
	}

	@Override
	protected void doCalculation(long forValue) {
		if (MathLib.isPrime((int)forValue)) {
			answers.add(forValue);
		}
	}

	@Override
	protected Number getFinalAnswer() {
		return MathLib.getSum(answers);
	}

	@Override
	protected boolean continueCalculating() {
		return counter < 2000000;
	}

	@Override
	protected Number getCorrectAnswer() {
		return new Euler010().getCorrectAnswer();
	}

}
